﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace VM.Common.EntityEnum
{
    public class EnumManager
    {
        public static string GetJobStatusRemark(int oValue)
        {
            JobStatusEnum jobStatusEnum = (JobStatusEnum)oValue;
            FieldInfo fileInfo = typeof(JobStatusEnum).GetField(jobStatusEnum.ToString());

            if (fileInfo != null && fileInfo.IsDefined(typeof(RemarkAttribute), true))
            {
                RemarkAttribute attribute = fileInfo.GetCustomAttribute<RemarkAttribute>();
                return attribute.GetRemark();
            }
            return jobStatusEnum.ToString();
        }

    }

    public class RemarkAttribute : Attribute
    {
        private string _ReMark = string.Empty;
        public RemarkAttribute(string remark)
        {
            _ReMark = remark;
        }

        public string GetRemark() => _ReMark;
    }

}
